<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Untitled Document</title>
    <!-- Bootstrap -->
	<link href="<%=request.getContextPath() %>/styles/skin/new/css/bootstrap.css" rel="stylesheet">
	<link href="<%=request.getContextPath() %>/styles/skin/new/css/custom.css" rel="stylesheet" type="text/css">
	
	<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/i18n/i18n_zh.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/lib/WdatePicker.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/bootstrap.js"></script>
<%@ include file="/pages/inc/taglibs.jsp"%>
	<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
	<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
	<!--[if lt IE 9]>
		  <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
		  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
		<![endif]-->
  </head>
  <body class="body">
	<nav class="navbar navbar-default navbar-fixed-top">
	  <div class="container">
	    <!-- Brand and toggle get grouped for better mobile display -->
	    <div class="navbar-header">
	      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#topFixedNavbar1" aria-expanded="false"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
	      <a class="navbar-brand" href="#">
	        <p class = "Brand"><span style="color: #3399cc">Robo</span>Tax </p>
          </a></div>
	    <!-- Collect the nav links, forms, and other content for toggling -->
	    <div class="collapse navbar-collapse" id="topFixedNavbar1">
	      <ul class="nav navbar-nav">
	        <li><a href="index.html">首页</a></li>
	        <li><a href="#" class="link">产品</a></li>
	        <li><a href="#">关于我们</a></li>
          </ul>
	      <ul class="nav navbar-nav navbar-right">
	        <li><a href="login.html">登录<span class="sr-only">(current)</span></a></li>
	        <li><a href="register.html">注册</a></li>
          </ul>
        </div>
	    <!-- /.navbar-collapse -->
      </div>
	  <!-- /.container-fluid -->
  </nav>
    <div class="container-fluid registration">
      <div class="row">
      <div class ="col-md-6 col-md-offset-3">
          <div class="regtitle center-block">
        <h2>登录</h2>
        </div>
      	<div class = "registrationblock center-block">
    
      
        <form>

        <label > 用户名 </label>
        <br>
        <input type="text" id="j_username" class="form-control">
        <br>
        <label > 密码 </label>
        <br>
        <input type="password" id="j_password" class="form-control">
        <br>
       
        <input class="btn register" type="button" id= "loginBotton" value="登录">
        </form>
        
        <p> 没有账号？<a href="register.html">注册</a></p>
         <p> 忘记密码？<a href="#">重启</a></p>
        </div>
      </div>
      </div>
    </div>
    
      <footer class="footer">
  	<div class="container-fluid">
    	<div class="row">
        	<h3>Copyright &copy; Robotax</h3>
        </div>
    </div>
  
  </footer>
	
	
	
	<script type="text/javascript">
	function testLogin() {
		if ($("#j_username").val() == "") {
			$("#j_username").focus();
			alert("用户名不能为空！");
			return false;
		} else if ($("#j_password").val() == "") {
			alert("密码不能为空！");
			$("#j_password").focus();
			return false;
		} else {
			//window.open("http://10.156.38.122:8080/ci-studio/paihangbang.jsp");
			return true;
		}
	}
	$("#loginBotton").click(function() {
		if (testLogin()) {
			var userName = $("#j_username").val();
			var password = $("#j_password").val();
			$.ajax({
				url : '<c:url value="/loginCheck" />',
				data : {
					userName : userName,
					password : password
				},
				type : 'POST',
				dataType : 'json',
				success : function(data) {
					if (data.flag == "success") {
						location.replace("/MPRO/company"); 
					} else {
						alert(data.message);
					}
				},
				error : function(data) {
					alert("error");
					alert(data);
					//if (data.flag == "success") {
					//location.replace("/MPRO/company"); 
					//} else {
					//	alert(data.message);
					//}
				}
			});
		} else {
			return;
		}
	});
</script>	
  </body>
</html>